'use strict';

// Declare app level module which depends on views, and components
angular.module('kaifala', [
  'ngRoute',
  'ngAnimate',
  'start',
  'main',
  'detail',
  'order',
  'myorder'
])
//module里有run方法，可以修改angular发起的post请求的请求头配置
.run(function($http){
    $http.defaults.headers.post =
    {'Content-Type':'application/x-www-form-urlencoded'};
})
//路由配置
.config(['$routeProvider', function($routeProvider) {
  $routeProvider
      .when('/start',{
        templateUrl: 'app/start/start.html',
        controller: 'startCtrl'
      })
      .when('/main',{
        templateUrl: 'app/main/main.html',
        controller: 'mainCtrl'
      })
      .when('/detail/:did',{
        templateUrl: 'app/detail/detail.html',
        controller: 'detailCtrl'
      })
      .when('/order/:did',{
        templateUrl: 'app/order/order.html',
        controller: 'orderCtrl'
      })
      .when('/myorder',{
        templateUrl: 'app/myorder/myorder.html',
        controller: 'myorderCtrl'
      })
      .otherwise({redirectTo: '/main'});
}])

;
